package org.example.config;



import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
/**
 * @author 荆延龙
 */
@EnableResourceServer
@Configuration
public class Oauth2Config extends ResourceServerConfigurerAdapter {
    @Override
    public void configure(HttpSecurity http) throws Exception {
        // 其他匹配的[剩下的]任何请求都需要授权
        http.authorizeRequests()
//                .antMatchers("/swagger-ui/**").permitAll()
//                .antMatchers("/save/**").permitAll()
//                .antMatchers("/save").permitAll()
//                .anyRequest().authenticated()
                .anyRequest().permitAll()
                .and()
                .csrf().disable()
                .httpBasic();
    }
}
